import time
import GlobalVariable

import my_config



# 主操作
def main():
    while(1):
        if GlobalVariable.RECORDSNUM.isdigit():
            GlobalVariable.records_num = int(GlobalVariable.RECORDSNUM)
        # 获取细节消息
        my_config.todayPointDetail(1)

        pointInfos= GlobalVariable.final_result["pointInfos"]
        # cache_info_list=pointInfos.get('cache_info_list')
        print('yes',pointInfos)
        # client = my_influxdb3.creat_client()
        # 传一个tag  多个file时要传一个集合 不支持中文
        # my_influxdb3.add(client,"JD",{"default":0},cache_info_list)
        time.sleep(60)



# endregion

def runTest(i):
    if i > 10:
        return
    try:
        if GlobalVariable.WSKEY is None or GlobalVariable.WSKEY.strip() == '':
            print("未获取到环境变量'WSKEY'，执行中止")
            return
        GlobalVariable.headers["wskey"] = GlobalVariable.WSKEY
        GlobalVariable.service_headers["tgt"] = GlobalVariable.WSKEY
        main()
    except Exception as e:
        print("出现错误：", e)
        print("准备重新执行...")
        time.sleep(3)
        runTest(++i)


# 读取配置文件
if __name__ == '__main__':
    runTest(0)

